export const _shouldUpdate = <U>(oldVersion: string, newVersion: string): boolean => {
  // X.X.X
  // X∈[0,9]

  // 1.0.0   1.0.1   true
  // 1.1.0   1.0.1   false
  // newArr  oldArr
  // 1.3.0   2.1.0

  const oldArr = oldVersion.split('.')
  const newArr = newVersion.split('.')

  for(let i = 0;i < newArr.length;i++) {
    if(newArr[i] > oldArr[i]) {
      return true
    } else if(newArr[i] < oldArr[i]) {
      return false
    }
  }
  return false
}

const result = _shouldUpdate<string>('1.0.0', '1.1.0')
const result1 = _shouldUpdate('1.3.0', '1.2.0')
const result2 = _shouldUpdate('2.1.0', '1.3.0')

console.log(result1, result2)